package com.xiaodou.mjf.application.core.service.impl;

import com.xiaodou.mjf.application.core.repository.FinancingStatisticsRepository;
import com.xiaodou.mjf.application.core.service.FinancingStatisticsService;
import com.xiaodou.mjf.entity.core.FinancingStatistics;
import com.xiaodou.mjf.infrastructure.common.app.JpaSimpleService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;


/***
 *
 * FinancingStatistics业务访问实现
 * @author XiaoDou.com Code Generator
 * @version 1.0
 * 2014-10-29 17:37:52
 *
 */
@Service @Transactional
public class FinancingStatisticsServiceImpl extends JpaSimpleService<FinancingStatistics,String> implements FinancingStatisticsService{

	Logger logger = LoggerFactory.getLogger(FinancingStatisticsServiceImpl.class);

    @Resource
    FinancingStatisticsRepository financingStatisticsRepository;

    @Override
    protected JpaRepository<FinancingStatistics, String> getRepository() {
        return financingStatisticsRepository;
    }

	@Override
	public Double getResidualAmountByFinanceId(String financeId) {
		return financingStatisticsRepository.getResidualAmountByFinanceId(financeId);
	}
	
	@Override
	public Integer getInvestCountByFinanceId(String financeId) {
		return financingStatisticsRepository.getInvestCountByFinanceId(financeId);
	}
	
	public FinancingStatistics findByfinanceId(String  finacingID) {
		
		return financingStatisticsRepository.findByFinanceId(finacingID);
	}

}

